'use strict'
import { Loading } from 'element-ui'

export default viewPath => {
  return resolve => {
    require(['@/views/' + viewPath + '.vue'], component => {
      resolve(component)
    })
  }
}
/**
 * 大屏页面过度加载
 * @param viewPath
 * @returns {(function(*): void)|*}
 */
export const big_import = (viewPath) => {
  return resolve => {
    require(['@/views/' + viewPath + '.vue'], component => {
      resolve(component)
    })
  }
}

/**
 * ElementUI 下的过度加载
 * @param viewPath
 * @returns {(function(*): void)|*}
 */
export const el_import = (viewPath) => {
  return resolve => {
    const el_ld = Loading.service({
      text: '加载中···'
    })
    require(['@/views/' + viewPath + '.vue'], component => {
      el_ld.close()
      resolve(component)
    })
  }
}
/**
 * VantUI 下的过度加载
 * @param viewPath
 * @returns {(function(*): void)|*}
 */
// import { Toast } from 'vant'
// export default viewPath => {
//   return resolve => {
//     const ld = Toast.loading({
//       duration: 0,
//       forbidClick: true,
//       loadingType: 'spinner'
//     })
//     require(['@/views/' + viewPath], component => {
//       ld.clear()
//       resolve(component)
//     })
//   }
// }
